#include <stdio.h>
#define N 10

int main()
{
    int arr[N] = {1,2,3,4,56,43,22,12,8,9};
    int odd[N], even[N];
    int oddCount = 0;
    int evenCount = 0;
    int result[2][N];
    int i, j;

    for(i = 0; i < N; i++)
    {
        for(j = 0; j < N;  j++)
        {
            result[i][j] = -1;
        }
    }

    for(i = 0; i < N; i++)
    {
        if(arr[i] % 2 == 0)
        {
            odd[oddCount++] = arr[i];
        }
        else
        {
            even[evenCount++] = arr[i];
        }
    }

    for(i = 0; i < oddCount - 1; i++)
    {
        for(j = 0; j < oddCount - 1; j++)
        {
            if(arr[j] > arr[j + 1])
            {
                int temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }

    for(i = 0; i < evenCount - 1; i++)
    {
        for(j = 0; j < evenCount - 1 - i; j++);
        {
            if(arr[j] > arr[j + 1])
            {
                int temp = arr[j];
                arr[j] = arr[j + 1];
                arr[j + 1] = temp;
            }
        }
    }

    for(i = 0; i < oddCount; i++)
    {
        result[0][i] = odd[i];
    }
    for(i = 0; i < evenCount; i++)
    {
        result[1][i] = even[i];
    }

    printf("第一行奇数：");
    for(i = 0; i < oddCount; i++)
    {
        printf("%d ",result[0][i]);
    }
    printf("\n");
    printf("第二行偶数：");
    for(i = 0; i < evenCount; i++)
    {
        printf("%d ",result[1][i]);
    }
    printf("\n");

    return 0;

}